#include "stdafx.h"
#include "getl.h"
using namespace std;

int get_larg(int** A, int type, int size)
{
	int max = 0;
	type = toupper(type);
	//	switch (type)
	//	{
	//	case '1':
	//	case 'N': 
	if (type == 1)
	{
		//	int max;// , max2, max;
		max = A[1][0];
		for (int i = 1; i < size; i++)
		{
			for (int j = 0; j < i; j++)
			{
				if (A[i][j] > max)
				{
					max = A[i][j];
					//	max1 = i;
					//	max = j;
				}
			}
		}
	}//; break;
	//case '2':
	//case 'P':
	if (type == 2)
	{
		//int max;
		//int a = 1;
		max = A[0][size];
		for (int i = 0; i < size-1; i++)
		{
			for (int j = 0; j < size; j++)
			{
				if (i<j)
				if (A[i][j] > max&&i<=size)
				{
					max = A[i][j];
				}
				//a++;
			}
			//a++;
		}
	}
	//}; break;
	//}
	return max;
}

int get_low(int** A, int type, int size)
{
	int min = 0;
	type = toupper(type);
	//	switch (type)
	//	{
	//	case '1':
	//	case 'N': 
	if (type == 1)
	{
		//	int max;// , max2, max;
		min = A[1][0];
		for (int i = 1; i < size; i++)
		{
			for (int j = 0; j < i; j++)
			{
				if (A[i][j] < min)
				{
					min = A[i][j];
					//	max1 = i;
					//	max = j;
				}
			}
		}
	}//; break;
	//case '2':
	//case 'P':
	if (type == 2)
	{
		//int max;
		//int a = 1;
		min = A[0][size-1];
		for (int i = 0; i < size-1; i++)
		{
			for (int j = 0; j < size; j++)
			{
				if (i<j)
				if (A[i][j] < min&&i<size)
				{
					min = A[i][j];
				}
				//a++;
			}
			//a++;
		}
	}
	//}; break;
	//}
	return min;
}